<template>
  <el-table
      :data="tableData"
      height="450"
      border
      style="width: 100%">
    <el-table-column
        v-for="item in tableColnum"
        :key="item.label"
        :label="item.label"
        :prop="item.prop"
        :fixed="item.fixed"
        align="center"
        min-width="150%">
    </el-table-column>
  </el-table>
</template>
<script lang="ts">
import {defineComponent, ref, watch} from 'vue'
export default defineComponent({
  name:'',
  props:{
    tableData:{
      required:true,
      type:Array
    }
  },
  setup(props){
    const tableColnum=[
      {prop:'category',label:'检查类别',fixed:true},
      {prop:'level',label:'检查级别',fixed:false},
      {prop:'checkId',label:'问题名称',fixed:false},
      {prop:'quesProduceDep',label:'问题产生单位',fixed:false},
      {prop:'according',label:'判定依据',fixed:false},
      {prop:'seriousLevel',label:'问题严重程度',fixed:false},
      {prop:'cause',label:'问题产生原因',fixed:false},
      {prop:'createTime',label:'问题产生时间',fixed:false},
      {prop:'keyWord',label:'问题关键词',fixed:false},
      {prop:'reformDep',label:'整改责任部门',fixed:false},
      {prop:'responsibilityPerson',label:'整改负责人',fixed:false},
      {prop:'startTime',label:'检查开始时间',fixed:false},
      {prop:'endTime',label:'检查结束时间',fixed:false},
      {prop:'questionDesc',label:'问题描述',fixed:false},
      {prop:'reformMethod',label:'整改措施',fixed:false},
      {prop:'rectificationFinishTime',label:'整改完成时间',fixed:false},
      {prop:'description',label:'备注',fixed:false},
      {prop:'isDuplicate',label:'问题是否重复',fixed:false},
      {prop:'isComplete',label:'整改是否完成',fixed:false},
      {prop:'overTime',label:'是否超时',fixed:'right'}
    ]
    const tableData=ref<Array<object>>([])
    watch(()=>props.tableData,(res)=>{
      tableData.value=res.map(item=>{
        return {
          ...item,
          isDuplicate:item.isDuplicate===1?'是':'否',
          isComplete:item.isComplete===1?'是':'否',
          overTime:item.overTime===1?'是':'否'
        }
      })
    })
    return {
      tableColnum,
      tableData
    }
  }
})
</script>

<style lang='scss' scoped>

</style>
